
#ifndef SEARCHDIALOG_H
#define SEARCHDIALOG_H

#include <BXmlDocument>
#include <BSource>
#include <BButtonGroup>
#include <BComboBox>
#include <BCheckBox>
#include <BLineEdit>
#include <BTextEdit>
#include <BTreeWidget>
#include <BDialog>

using namespace BWE;

class SearchDialog : public BDialog
{
	BOBJECT(SearchDialog);
public:
	SearchDialog(BWidget* parent = 0);
	~SearchDialog();

protected:
	void searchSource(BSource* source);
	void searchText(BTextEdit* textEdit);

protected:
	void slotAssetChanged(BObject* object, const BValue& value);
	void slotPropertyChanged(BObject* object, const BValue& value);
	void slotModeButtonChecked(BObject* object, const BValue& value);
	void slotInputEditStarted(BObject* object, const BValue& value);
	void slotCheckBoxToggled(BObject* object, const BValue& value);
	void slotBackwardButtonClicked(BObject* object, const BValue& value);
	void slotForwardButtonClicked(BObject* object, const BValue& value);
	void slotEntireButtonClicked(BObject* object, const BValue& value);

protected:
	virtual void showEvent(const BEvent& event);
	virtual void hideEvent(const BEvent& event);

	virtual void paintEvent(const BEvent& event);

private:
	BButtonGroup*	_modeButtonGroup;
	BButton*		_searchOnlyButton;
	BButton*		_findReplaceButton;
	BComboBox*		_inputComboBox;
	BComboBox*		_replaceComboBox;
	BCheckBox*		_caseSensitiveCheckBox;
	BCheckBox*		_fullWordCheckBox;
	BCheckBox*		_useRegularCheckBox;
	BButtonGroup*	_lookinButtonGroup;
	BCheckBox*		_openChangedFilesCheckBox;
	BButton*		_backwardButton;
	BButton*		_forwardButton;
	BButton*		_entireButton;

	BXmlDocument				_memoryDocument;
	BHolder<BTreeWidget>		_resultTreeWidget;
	BString::const_iterator		_position;
};

#endif
